package com.xq.shop.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	public static final String FORMAT_01 = "yyyy-MM-dd";
	public static final String FORMAT_02 = "MM月dd日";
	public static final String FORMAT_03 = "HH:mm";
	public static final String FORMAT_04 = "yyyy/MM/dd";
	public static final String FORMAT_05 = "yyyy";
	
	public static String getWeekDayString(Date date) {
		
		String weekString = "";
		final String dayNames[] = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
		weekString = dayNames[dayOfWeek - 1];
		return weekString;
	}
	
	public static String getWeekDayBlankString(Date date) {
		
		String weekString = "";
		final String dayNames[] = { "周 日", "周 一", "周 二", "周 三", "周 四", "周 五", "周 六" };
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
		weekString = dayNames[dayOfWeek - 1];
		return weekString;
	}
	
	public static String format(Date date, String match){
		
		SimpleDateFormat format = new SimpleDateFormat(match);
		return format.format(date);
	}
}